UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c0eOnpuD+eiNKWWhFZDFOy87yMWeahtHV5sW2OqTGvI=' 
WHERE 
  key_id = 'd4c2cbf641457d6dc79b45632209a304fffb8f6c07b8469102161fe349270414' 
  AND (
    token = 'c0eOnpuD+eiNKWWhFZDFOy87yMWeahtHV5sW2OqTGvI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029