UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kk+9kAZ8k5I6tR1IiMBzUvWexvDswFXA/K0AZ3y0q+E=' 
WHERE 
  key_id = '28461f485f82c06361cf404ab9d465a70449c01048c8735705def94084db5297' 
  AND (
    token = 'kk+9kAZ8k5I6tR1IiMBzUvWexvDswFXA/K0AZ3y0q+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026