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