UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o25ru0ujCr7ihtksGCCvgU/JD/nl/6sYePVY61GCgUg=' 
WHERE 
  key_id = '39c3315427fe8ce29ff7571466b5fe805a43c4695c75a2eaf3ee2dc6c5211f16' 
  AND (
    token = 'o25ru0ujCr7ihtksGCCvgU/JD/nl/6sYePVY61GCgUg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044