UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aKo73uMpN/CC5peZ90+SFdCU+pzZWHRFVyDv6cx0GZ0='
WHERE
key_id = '37a8e7db1122ba8cf49c1a951deed3b013658bb05e1a918b7235d62ada6525cc'
AND (
token = 'aKo73uMpN/CC5peZ90+SFdCU+pzZWHRFVyDv6cx0GZ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)