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