UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qKDmEHQ4bJWya8Wmo27Cbu0Mq8budx00uHKtpDSk7rM='
WHERE
key_id = '847dacc6bf094adc2411eb80a3a6c007c3f03e1e1ebaf706dfb3efd2e0e695b9'
AND (
token = 'qKDmEHQ4bJWya8Wmo27Cbu0Mq8budx00uHKtpDSk7rM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)