UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iekhdMZ566KfZvMR4l7h/F1JEb85vrOpVIKI4est5Qc=' 
WHERE 
  key_id = 'c41c2a1988da63f865af2e62088ab9d326a2b867b8865669ef238d7469866716' 
  AND (
    token = 'iekhdMZ566KfZvMR4l7h/F1JEb85vrOpVIKI4est5Qc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018