UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BEJRiR7u/uXVYZsj3gB2luDXbXVTWbtdfcsjmgP5N9A=' 
WHERE 
  key_id = '7fc014fdc67d10a99ee566d27eab9816a752857a6700164c82ad6537297f7c72' 
  AND (
    token = 'BEJRiR7u/uXVYZsj3gB2luDXbXVTWbtdfcsjmgP5N9A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046