UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E5zqrUZ+r441klKMM4wTAeLLYPJM//ld+AqHMKDC0jM='
WHERE
key_id = 'c9823f8de6b1d8ae7beac5bfa8ad3c1e0a684e4d87e7352f673fa4b688f8812f'
AND (
token = 'E5zqrUZ+r441klKMM4wTAeLLYPJM//ld+AqHMKDC0jM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)