UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p+sSy06/MSq9Lf49UF9P0sePFNJPX7xQrUpSozW7Cnw='
WHERE
key_id = 'e032485f3516e71b673a17c766841635dd6f852ff2af1d47633d061c1f43b6cc'
AND (
token = 'p+sSy06/MSq9Lf49UF9P0sePFNJPX7xQrUpSozW7Cnw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)