UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Tc+0qg72Woo1qiE0dOKOwsybFeCR7OHem9E46X70YtM='
WHERE
key_id = 'd42389ae229a7ac972f8c9aaa346de2a204e175f571c9238874f92c4a2d0dd6a'
AND (
token = 'Tc+0qg72Woo1qiE0dOKOwsybFeCR7OHem9E46X70YtM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)