UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gTfkZDTzAi2LfOj0EM61Xw6kACGxRF8S3FtPbgLWqdQ='
WHERE
key_id = 'c9dd4f4b074b0700664c65aef4774a348d3ea38e1cf1f37b91a6ba78d09b1ba0'
AND (
token = 'gTfkZDTzAi2LfOj0EM61Xw6kACGxRF8S3FtPbgLWqdQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)