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