UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M8uYwKOi1aieEpXrgIhCP9U9r/nNO/I69biHIO9uKTw='
WHERE
key_id = 'b54473db183399a0f3fd69bb043d1e0408531ae4a3ade0dfc21d10fbce706796'
AND (
token = 'M8uYwKOi1aieEpXrgIhCP9U9r/nNO/I69biHIO9uKTw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)