UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dL9twLbTjw8NlGjktX7OAEiEtXzrCKgyD2dHIBuz+pw='
WHERE
key_id = '6f45fab9c662058134b10cf8429581b34c8e41fa85cb60501b575f7f039b3590'
AND (
token = 'dL9twLbTjw8NlGjktX7OAEiEtXzrCKgyD2dHIBuz+pw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)