UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X/zZ61wTanvcyWNQRgmjgdEPSgaliElglPIryCWXVWY=' 
WHERE 
  key_id = 'fb074815eebc90598209c80003663fd6068cd6d5583a8e853b9b09dba43be748' 
  AND (
    token = 'X/zZ61wTanvcyWNQRgmjgdEPSgaliElglPIryCWXVWY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041