UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o1Dx88kmFgeUcvoX84umO2sMpJ5Ad3S8R1oYbhtzKxY=' 
WHERE 
  key_id = 'b8c4bfb03fb8e3a45c58e21ea773a5773d92babcace805d09090707a77d6cc26' 
  AND (
    token = 'o1Dx88kmFgeUcvoX84umO2sMpJ5Ad3S8R1oYbhtzKxY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032