UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'awPEXdA1sAsMYAzGduNQFr8qZ5ba/8g0dYybQMAauK0=' 
WHERE 
  key_id = '99a95cd05171dead9763d496984da924ae55f3d61cab9950e95142ae025d01da' 
  AND (
    token = 'awPEXdA1sAsMYAzGduNQFr8qZ5ba/8g0dYybQMAauK0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038