UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9H8u56P3jhFG5JQDmJxB+qsbfQYZIJLGen7szLpTKis=' 
WHERE 
  key_id = '671ca4055edc7ad4b86112be359c61033687d90fcc24f1c4d53f5b801cd022bb' 
  AND (
    token = '9H8u56P3jhFG5JQDmJxB+qsbfQYZIJLGen7szLpTKis=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042