UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7xUEodzuvkkQj11i9nMykKcNElc49vmMHw2Kd802qqw=' 
WHERE 
  key_id = '79f7063b80201d9625510e2797c997335e7360ce8e0897104a27e0f7e4104e99' 
  AND (
    token = '7xUEodzuvkkQj11i9nMykKcNElc49vmMHw2Kd802qqw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031