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