UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QLiV4r+MLgaey4034ZIrRHa0T4+wzGtWzA7X65ZxXZU='
WHERE
key_id = '058f3db6e118ee9e147141ddb9de27d1f864519cb0da11bb3b00cb143ae4b199'
AND (
token = 'QLiV4r+MLgaey4034ZIrRHa0T4+wzGtWzA7X65ZxXZU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)