UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wIscFwtRAE/VfVTZmIS6BEroIsQzEgNIeCAQ5zJnFD4='
WHERE
key_id = 'a49aa5fe113b67189bc8d90375ef28a5be56bdcf7667307248204e14a84e4aa5'
AND (
token = 'wIscFwtRAE/VfVTZmIS6BEroIsQzEgNIeCAQ5zJnFD4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)