UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1wDTF8K+WoLyx6gbKpwn1kNhdwz7c0lbmiW4122RrL0='
WHERE
key_id = 'a31ff46f7de525229b1f4b6868c5d38ec3697928b126ed9c21f0b066c93bdbae'
AND (
token = '1wDTF8K+WoLyx6gbKpwn1kNhdwz7c0lbmiW4122RrL0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)